# pywebdev-apt-install-test-script.py
# 
#

# Copyright (C) 2008  James C. McDonald
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License 
# Version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the 
#
# Free Software Foundation, Inc.
# 59 Temple Place - Suite 330
# Boston, MA  02111-1307, USA.
#

import sys
import os

## DONT HAVE
# funkload
# selienium
# supervisor
# python-memcached
# figleaf titus brown
# mochikit, dojo, prototype javascript libs
# wsgi colubrid
# wsgi rhubarbtart
# wsgi utils
# unix2dos
# komodo-edit, wing edit
# templates (meld3,buffet,Qpy,clearsilver)
# pythoncssutils,dulcinea,durus
## DONT HAVE

## LOWER ######
#'python-psycopg', OBSOLETE
#'docbook-utils' # includes teTeX
# mysql python-mysqldb
#'lighttpd libterm-readline-perl-perl'
#'python-gdchart',
#'python-4suite python-4suite-xml python-4suite-rdf...',
#'python-unit',
#'pylint'
#'python-librdf',
## LOWER ######


#'eclipse eclipse-cdt ant ant-optional eclipse-jdt eclipse-pde eclipse-platform eclipse-rcp eclipse-source junit libbcel-java libcommons-beanutils-java libcommons-collections-java libcommons-collections3-java libcommons-dbcp-java libcommons-digester-java libcommons-el-java libcommons-launcher-java libcommons-logging-java libcommons-modeler-java libcommons-pool-java libjsch-java liblog4j1.2-java liblucene-java liblucene-java-doc libmx4j-java libregexp-java libswt3.2-gtk-java libswt3.2-gtk-jni libtomcat5.5-java libcommons-codec-java',

needed_pkgs = [
'eclipse',
'eclipse-cdt',
'eclipse-pydev bicyclerepair',
]

java_pkgs = [
'sun-java6-jdk sun-java6-bin sun-java6-javadb',
'libreadline-java',
'jython',
]

python_needed_pkgs = [
'python',
'python-central',
'python-support',
'python-dev python2.5-dev',
'python-doc python2.5-doc',
'python-docutils python-roman',
'python2.4 python2.4-minimal',
'ipython python-pexpect',
'python-elementtree python-celementtree python-elementtidy'
'python-setuptools',
'python-distutils-extra autoconf automake1.7 gettext intltool',
'python-egenix-mx-base-dev python-egenix-mxdatetime python-egenix-mxtools',
'diveintopython',
'python-apt',
'python-aptsources',
'python-configobj',
'python-imaging',
'python-libxml2',
'python-libxslt1',
'python-lxml',
'python-m2crypto'
'python-clientcookie',
'python-ctypes libffi4',
'python-ooolib',
'python-pexpect',
'python-urljr',
'python-utidylib',
'python-crypto',
'python-psyco',
'python-psycopg2',
'python-pysqlite1.1',
'python-pysqlite2',
'python-pyopenssl',
'python-protocols',
'python-dispatch',
'python-routes',
'python-flup',
'python-beautifulsoup',
'python-reportlab python-reportlab-accel',
'python-xml',
'python-zopeinterface',
'python-subversion',
'python-svn',
'python-dns',
'python-formencode',
'python-sqlalchemy',
'python-migrate',
'python-sqlobject',
'python-reverend',
'python-rrd',
'python-rdflib',
'python-feedparser',
'python-gdata',
'python-json',
'python-simplejson',
'python-imdbpy',
'python-libgmail',
'python-mechanize python-clientform',
'python-openid python-urljr python-yadis',
'python-pyrex',
'python-pyrss2gen',
'python-httplib2',
'python-textile',
'python-authkit',
'python-nose',
'python-coverage',
'python-epydoc',
'python-happydoc',
'python-profiler',
'python-pyparsing',
'python-twill',
'pychecker',
'python-cheetah',
'python-kid python-turbokid',
'python-genshi',
'python-empy',
'python-mako',
'python-simpletal',
'python-myghty python-myghtyutils',
'python-tz',
'python-twisted-bin',
'python-twisted python-twisted-bin python-twisted-conch python-twisted-core python-twisted-lore python-twisted-mail python-twisted-names python-twisted-news python-twisted-runner python-twisted-web python-twisted-words python-twisted-web2',
'python-turbojson',
'paste-common python-paste python-pastedeploy python-pastescript python-pastewebkit',
'python-pgsql libpq4',
'python-beaker',
'python-decorator',
'python-webhelpers',
]

web_frameworks = [
'python-webpy',
'python-albatross',
'python-moinmoin moinmoin-common editmoin',
'python-django',
'python-quixote',
'python-cherrypy',
'python-turbogears',
'pyblosxom',
'zope3 zope-common',
'python-pudge',
'python-pylons',
]

general_pkgs = [
'apg',
'curl',
'm4',
'bison bison-doc',
'bzip2',
'cdrecord',
'cvs',
'bash',
'dvd+rw-tools',
'dvdrtools',
'libdb4.6 libdb4.6-dev',
'expat',
'gzip',
'gnupg',
'make',
'libtool autotools-dev libc6-dev linux-libc-dev',
'libxml2',
'libxslt1.1',
'libneon25',
'rsync',
'openssh-server',
'subversion',
'tar',
'vim vim-runtime',
'vim-python vim-gui-common',
'zip',
'unzip',
'tidy libtidy-dev libtidy-0.99-0',
'csstidy',
'opensp libosp5 libostyle1c2',
'openjade',
'docbook',
'docbook-xml docbook-xsl',
'docbook-dsssl',
'rrdtool librrd2',
'apache2 apache2-mpm-worker apache2-utils apache2.2-common',
'libapache2-mod-scgi python-scgi',
'libapache2-mod-fastcgi',
'libapache2-mod-python',
'memcached libevent1',
'postgresql postgresql-8.2 postgresql-client-8.2 postgresql-client-common postgresql-common postgresql-plpython-8.2',
'sqlite libsqlite0',
]


#
errorL = []

for pkg in needed_pkgs:
    sys.stderr.write("****** [%-20s] *****************************\n" % pkg)
    exit_code = os.system("sudo apt-get install "+pkg)
    if exit_code != 0:
        errorL.append("Error [%i] installing [%s]." % (exit_code,pkg))

if len(errorL) >0:
    sys.stderr.write("****** ERRORS ******************************\n")
    for error in errorL:
        sys.stderr.write("%s\n" % error)
else:
    sys.stderr.write("****** NO ERRORS ***************************\n")
    sys.stderr.write("****** NO ERRORS ***************************\n")

sys.exit()
